package com.mingtu.hikvideo2.adapter;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mingtu.hikvideo2.R;
import com.mingtu.hikvideo2.bean.VideoListBean;


/**
 * 描述：
 * 修改人：
 * 修改时间：
 * 修改备注：
 *
 * @author wkk
 */

public class VideoAdapter2 extends BaseQuickAdapter<VideoListBean.PageBean.ListBean, BaseViewHolder> {
    private Context context;

    public VideoAdapter2(Context context) {
        super(R.layout.item_video2);
        this.context = context;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, VideoListBean.PageBean.ListBean listBean) {
        String picUrl = listBean.getPicUrl();
        String cameraName = listBean.getName();
        String deptName = listBean.getDeptName();

        RequestOptions requestOptions = new RequestOptions() //Glide 使用
                .centerCrop()
                .error(R.mipmap.img_data_error)
                .skipMemoryCache(false) //解决刷新闪烁的问题
                .diskCacheStrategy(DiskCacheStrategy.ALL); //全部使用磁盘缓存

//        Glide.with(context)
//                .load(picUrl)
//                .apply(requestOptions)
//                .into((ImageView) helper.getView(R.id.raiv));

        helper.setText(R.id.tv_text1, "摄像头名称：" + cameraName);
        helper.setText(R.id.tv_text2, "所属部门：" + deptName);
    }

}
